// 引入共用样式表
require('../../assets/css/index.js')
require('../../assets/css/index.less')

//引入当前页面的less文件


require('../../assets/css/basic.less')
require('./login.less')

// 引入公用js
let dom = require('../../utils/dom.js')
let https = require('../../utils/https.js')
dom.ready(function () {
    dom.getEle("#btn").addEventListener("click", function () {
        let telVal = dom.getEle("#tel").value;
        let psdVal = dom.getEle("#psd").value;
        if (telVal && psdVal) {
            https.post('/api/user/login',
                {
                    account:telVal,
                    password:psdVal,
                },function (res) {
                    console.log(res);
                    if (res.errno == 0) {
                        alert("恭喜成功登录")
                        // console.log(res);
                        localStorage.setItem("tk",res.data.token)
                        window.location.href = 'home.html'
                    } else {
                        alert("res.messege")
                    }
                })
               
        }

    })
})
